#define _CRT_SECURE_NO_WARNINGS 1
#include"sequentialtable.h"
void initsq(sq* phead)
{
	phead->arr = (sq*)malloc(sizeof(l) * 4);
	assert(phead->arr);
	phead->capacity = 4;
	phead->size = 0;
}
void pushfront(sq* phead, l x)
{
	assert(phead->arr);
	if (phead->size == phead->capacity)
	{
		sq* tem = (sq*)realloc(phead->arr, sizeof(l) * (phead->capacity) * 2);
		assert(tem);
		phead->capacity = 2 * (phead->capacity);
		phead->arr = tem;
	}
	else
	{
		if (phead->size == 0)
		{
			phead->arr[phead->size] = x;
			(phead->size)++;
		}
		else
		{
			l beagin = phead->size;
			while (beagin != 0)
			{
				phead->arr[beagin] = phead->arr[beagin - 1];
				beagin--;
			}
			phead->arr[beagin] = x;
			(phead->size)++;
		}
	}
}
void printsq(sq s)
{
	l i = 0;
	for (i = 0; i < (s.size); i++)
	{
		printf("%d ", s.arr[i]);
	}
}